﻿using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UMLSynthesizer.CSharpAnalyzer.Helpers;
using UMLSynthesizer.LangAnalyzer.Statements;

namespace UMLSynthesizer.CSharpAnalyzer.Statements
{
    class CSharpFinallyClause : CSharpStatementBase, IFinallyClause
    {
        #region Fields

        FinallyClauseSyntax finallyBlock;
        CSharpStatementBlockHelper blockHelper;

        #endregion

        #region Constructor

        public CSharpFinallyClause(FinallyClauseSyntax finallyBlock, IStatementBase parentStatement)
            : base(null, parentStatement, null, StatementKinds.Finally)
        {
            this.finallyBlock = finallyBlock;
            blockHelper = new CSharpStatementBlockHelper(this,
                () => finallyBlock.Block.Statements);
        }

        #endregion

        #region Properties

        public IEnumerable<IStatementBase> ContainedStatements { get { return blockHelper.ContainedStatements; } }

        #endregion
    }
}
